package com.lm.scau.mailottodemo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

import me.drakeet.mailotto.Mail;
import me.drakeet.mailotto.Mailbox;
import me.drakeet.mailotto.OnMailReceived;

/**
 * Function:
 * auth：liming on 2016/5/4 11:12
 * mail：liming@wxchina.com
 */
public class TargetActivity extends AppCompatActivity {
    private TextView tvWait;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_target);
        tvWait = (TextView) findViewById(R.id.tvWait);
        Mailbox.getInstance().atHome(this);

    }

    @OnMailReceived
    public void onMailReceived(Mail mail) {
        //// TODO: 2016/5/23  
        tvWait.setText(mail.content.toString());
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Mailbox.getInstance().leave(this);
    }
}
